﻿using BussinessObject.ObjectTwo;
using Class_Entity.ObjectTwo;
using ProjectHK3.App_Code;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectHK3.Object_One
{
    public partial class News : System.Web.UI.Page
    {
        B_Insert bi = new B_Insert();
        C_News ne = new C_News();

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            bool tam;
            ne.TITLE = TextBox1.Text;
            ne.SUBJECT = TextBox2.Text;
            ne.BODY = FreeTextBox1.Text;
            ne.CREATE_DATE = DateTime.Now.ToShortTimeString();
            if (CheckBox1.Checked == true)
            {
                tam = true;
            }
            else
            {
                tam = false;
            }
            ne.STATUS = tam;
            if (bi.InsertNews(ne) == false)
            {
                Alert.Show("Insert Fail !!!");
            }
            else
            {
                Alert.Show("Insert Successful!");
            }
        }
    }
}